package com.adingxiong.quickstart.project.service.impl;

import com.adingxiong.quickstart.project.entity.GoodsInfo;
import com.adingxiong.quickstart.project.entity.vo.GoodsInfoVo;
import com.adingxiong.quickstart.project.mapper.GoodsInfoMapper;
import com.adingxiong.quickstart.project.service.IGoodsInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * kpi属性id 服务实现类
 * </p>
 *
 * @author xiongc
 * @since 2020-06-02
 */
@Service
public class GoodsInfoServiceImpl extends ServiceImpl<GoodsInfoMapper, GoodsInfo> implements IGoodsInfoService {
    @Override
    public List<GoodsInfoVo> findHomeContent(Map<String, Object> param) {
        return baseMapper.findHomeContent(param);
    }

    @Override
    public HashMap<Integer, String> findNameByIds(List<Integer> ids) {
        HashMap<Integer,String> result = new HashMap<>();
        List<GoodsInfo> goodsInfos = baseMapper.selectBatchIds(ids);
        if(goodsInfos != null && goodsInfos.size()>0){
            for(GoodsInfo info : goodsInfos){
                result.put(info.getId(),info.getGoodsName());
            }
        }
        return result;
    }
}
